package com.augurit.gzcgwsp.lhsp.convert;

import java.util.ArrayList;
import java.util.List;
import org.dozer.DozerBeanMapper; 

import com.augurit.gzcgwsp.lhsp.entity.LhspUpdateFlowState;
import com.augurit.gzcgwsp.lhsp.web.form.LhspUpdateFlowStateForm;

public class LhspUpdateFlowStateConvert {
	public static LhspUpdateFlowStateForm convertVoToForm(LhspUpdateFlowState entity) {
		if(entity != null) {
			LhspUpdateFlowStateForm form = new DozerBeanMapper().map(entity, LhspUpdateFlowStateForm.class);
			return form;
		}else
			return null;
	}
	
	public static List<LhspUpdateFlowStateForm> convertVoListToFormList(List<LhspUpdateFlowState> lhspUpdateFlowStateList) {
		if(lhspUpdateFlowStateList != null && lhspUpdateFlowStateList.size() > 0) {
			List<LhspUpdateFlowStateForm> lhspUpdateFlowStateFormList = new ArrayList();
			for(int i=0; i<lhspUpdateFlowStateList.size(); i++) {
				lhspUpdateFlowStateFormList.add(convertVoToForm(lhspUpdateFlowStateList.get(i)));
			}
			return lhspUpdateFlowStateFormList;
		}
		return null;
	}
	
	
	public static void convertFormToVo(LhspUpdateFlowStateForm form, LhspUpdateFlowState entity) {
        if (form == null) return;
        if (entity == null) entity = new LhspUpdateFlowState();        
        new DozerBeanMapper().map(form, entity);
    }
	
	public static List<LhspUpdateFlowState> convertFormListToVoList(List<LhspUpdateFlowStateForm> LhspUpdateFlowStateFormList) {
		if(LhspUpdateFlowStateFormList != null && LhspUpdateFlowStateFormList.size() > 0) {
			List<LhspUpdateFlowState> lhspUpdateFlowStateList = new ArrayList();
			for(int i=0; i<LhspUpdateFlowStateFormList.size(); i++) {
				LhspUpdateFlowState LhspUpdateFlowState = new LhspUpdateFlowState();
				convertFormToVo(LhspUpdateFlowStateFormList.get(i), LhspUpdateFlowState);
				lhspUpdateFlowStateList.add(LhspUpdateFlowState);
			}
			return lhspUpdateFlowStateList;
		}
		return null;
	}
	
}
